﻿using ProjBackEnd.Models.AppModel.AppApproveModel;
using ProjBackEnd.Models.AppModel.AppUserModel;
using ProjBackEnd.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace ProjBackEnd.Controllers
{
    public class AppApproveController : ApiController
    {
        /// <summary>
        /// 获取企业及待审批数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/GetCompanyWaitYWApprove")]
        public HttpResponseMessage GetCompanyWaitYWApprove([FromBody] GetCompanyWaitYWApproveModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.GetCompanyWaitYWApprove(model);
            return ControllerHelper.GetResponse(result); 
        }

        /// <summary>
        /// 取待审批的业务单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/GetWaitYWApproveBill")]
        public HttpResponseMessage GetWaitYWApproveBill([FromBody] GetWaitYWApproveBillModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.GetWaitYWApproveBill(model);
            return ControllerHelper.GetResponse(result);
        }

        /// <summary>
        /// 取业务单明细
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/GetWaitYWApproveBillDetail")]
        public HttpResponseMessage GetWaitYWApproveBillDetail([FromBody] GetWaitYWApproveBillDetailModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.GetWaitYWApproveBillDetail(model);
            return ControllerHelper.GetResponse(result);
        }


        /// <summary>
        /// 业务单拒绝
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/RefuseYWBill")]
        public HttpResponseMessage RefuseYWBill([FromBody] RefuseYWBillModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.RefuseYWBill(model);
            return ControllerHelper.GetResponse(result);
        }

        /// <summary>
        /// 业务单审批通过
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/ApproveYWBill")]
        public HttpResponseMessage ApproveYWBill([FromBody] RefuseYWBillModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.ApproveYWBill(model);
            return ControllerHelper.GetResponse(result);
        }


        /// <summary>
        /// 获取审批文件列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/FindApproveFiles")]
        public HttpResponseMessage FindApproveFiles([FromBody] FindApproveFileModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.FindApproveFiles(model);
            return ControllerHelper.GetResponse(result);
        }
         

        /// <summary>
        /// 获取企业及待结算审批数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/FindCompanyWaitFNApprove")]
        public HttpResponseMessage FindCompanyWaitFNApprove([FromBody] GetCompanyWaitYWApproveModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.FindCompanyWaitFNApprove(model);
            return ControllerHelper.GetResponse(result);
        }

        /// <summary>
        /// 取待审批的结算单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/FindWaitFNApproveBill")]
        public HttpResponseMessage FindWaitFNApproveBill([FromBody] FindWaitFNApproveBillModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.FindWaitFNApproveBill(model);
            return ControllerHelper.GetResponse(result);
        }

        /// <summary>
        /// 取结算单明细
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/FindWaitFNApproveBillDetail")]
        public HttpResponseMessage FindWaitFNApproveBillDetail([FromBody] FindWaitFNApproveBillDetailModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.FindWaitFNApproveBillDetail(model);
            return ControllerHelper.GetResponse(result);
        }

        /// <summary>
        /// 获取结算单文件列表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/FindApproveFNFiles")]
        public HttpResponseMessage FindApproveFNFiles([FromBody] FindApproveFileModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.FindApproveFNFiles(model);
            return ControllerHelper.GetResponse(result);
        }


        /// <summary>
        /// 结算单拒绝
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/RefuseFNBill")]
        public HttpResponseMessage RefuseFNBill([FromBody] RefuseYWBillModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.RefuseFNBill(model);
            return ControllerHelper.GetResponse(result);
        }


        /// <summary>
        /// 结算单审批通过
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [System.Web.Http.HttpPost]
        [Route("api/AppApprove/ApproveFNBill")]
        public HttpResponseMessage ApproveFNBill([FromBody] RefuseYWBillModel model)
        {
            AppApproveService svc = new AppApproveService();
            string result = svc.ApproveFNBill(model);
            return ControllerHelper.GetResponse(result);
        }



    }
}
